<template>
	<view>
		<u-navbar title="我的完拼卡" :fixed="true" :placeholder="true" :safeAreaInsetTop="true" :autoBack="false"
			leftIconColor="#666" titleStyle="color:#333" bgColor="#10191F" rightText="规则说明" @rightClick="right"
			@leftClick="leftClick"></u-navbar>
		<!-- 车辆信息 -->
		<view class="wrap" v-for="(item,index) in selllist" :key="index" >
			<view class="tit">
				<text>完拼卡 {{item.goods_number}}</text>
				<text>{{item.carpool_target_name}}</text>
			</view>
			<view class="lottery_code flex_dq"  v-if="item.status==2&&item.numbers.length>0" >
				<view class="lottery_code_box ">
					<view class="lottery_box flex_c" v-for="(itm,idx) in item.numbers" :key="idx">
						<view class="winning" >
							<text class="win_txt"  >{{itm.number}}</text>
			
						</view>
					</view>
			
				</view>
			</view>
			<view class="mainwrap" v-if="item.status==0||item.status==3||item.status==6"  @click="goother(item.status,item.space_id,item.id)">
				<image  class="car_logo"  :src="item.car_logo" mode="" ></image>
				<image class="carimg" :src="item.cover" mode=""></image>
				<view class="tag">
					<text>完拼时间：{{item.create_time}}</text>
					<text>参与配号次数：{{item.match_number}}</text>
				</view>
				<image    v-if="item.status==3||item.status==6" class="tagimg" src="../../static/image/winimg.png" mode=""></image>
			</view>
		</view>
		<noDatas :xxxList="selllist" :type="2" :status="status" :showMore="false"></noDatas>
		<view class="empty3">
			
		</view>
	
<!-- 		<view class="botbox"  >
			<view class="tit">
				中奖号码
			</view>
			<view class="botbox-wrap">
				<view class="botbox-item"  >
					{{firstDigit}}
				</view>
				<view class="botbox-item" >
					{{secondDigit}}
				</view>
				<view class="botbox-item" v-if="thirdDigit" >
					{{thirdDigit}}
				</view>
			</view>
		</view> -->
<!-- 		<u-popup :show="show" mode="center" @close="show=false" bgColor="transparent"
			:closeOnClickOverlay="true">
			<view class="lottery_code flex_dq" style="background: #111B23;">
				<view class="lottery_code_box "  style="padding-bottom: 40rpx;" >
					<view class="lottery_box flex_c" v-for="(item,index) in 209">
						<view class="winning">
							<text class="win_txt">{{item}}</text>
						</view>
						<text v-else>{{item}}</text>
					</view>
					
				</view>
			</view>
		</u-popup> -->
		<u-popup :show="tipShow" mode="center" @close="tipShow = false" closeable bgColor="transparent">
			<view class="prompt flex_ZC">
				<text class="prompt_tit">{{rule}}</text>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import{Numindex,carindex,carpoolingConfig,lotteryNumber} from "../../api/mycar.js"
	export default {
		data() {
			return {
				price: '360000',
				selectArr: [{
						id: 1,
						title: '完成拼车',
						isSelect: false
					},
					{
						id: 2,
						title: '账户可用余额大于等于10万',
						isSelect: false
					},
					{
						id: 3,
						title: '更多选择条件',
						isSelect: false
					},
					{
						id: 4,
						title: '更多选择条件',
						isSelect: false
					},
					{
						id: 5,
						title: '更多选择条件',
						isSelect: false
					}
				],
				hint: '使用超级交付后，立即获得实车交付，同时账户可用余额扣减10万',
				show:false,
				showrule:false,
				tipShow:false,
				id:"",
				text:"等待配号",
				status:1,
				car_logo:"",
				info:{},
				list:[],
				firstDigit:"?",
				secondDigit:"?",
				thirdDigit:"?",
				rule:"",
				selllist:[],
				page: 1,
				size: 20,
				selnum: "",
				status: 'loadmore', //加载前值为loadmore，加载中为loading，没有数据为nomore
				show:false,
			}
		},
		onLoad() {
			// this.getid()
			this.getrule()
			this.getnum22()
		},
		methods: {
			goother(status,space_id,ids){
				if(status==0){
					uni.navigateTo({
						url:"/pagesMy/mycollection/collectionlist?id="+space_id
					})
				}
				if(status==3||status==6){
					uni.navigateTo({
						url:"/pagesMy/nationalCarPooling/myDelivery?id="+ids
					})
				}
			},
			getnum22(){
				lotteryNumber().then(res=>{
					if(res.data.winning_number){
						let numberStr = res.data.winning_number
						// 使用 split 方法将字符串转为数组
						let digitsArray = numberStr.split('');
						// 分别将每一位数字存入不同的变量
						let [firstDigit, secondDigit, thirdDigit] = digitsArray;
						this.firstDigit=firstDigit,
						this.secondDigit=secondDigit
						this.thirdDigit=thirdDigit
					}
					if (res.code == 1) {
						let list = res.data.matching_number_data.data;
						this.selllist = this.page == 1 ? list : this.selllist.concat(list);
						// console.log(this.goodlist2);
						if (list.length < this.size) this.status = 'nomore';
						else this.status = 'loading';
					}
					console.log(res)
				})
			},
			getrule(){
				carpoolingConfig().then(res=>{
					this.rule=res.data.numbering_rules_value
				})
			},
			getid() {
				carindex().then(res => {
					this.id = res.data.member_carpool.id
					this.info = res.data.member_carpool
					this.car_logo = res.data.member_carpool.car_logo
					this.getnum()
					// console.log(this.id, "asdasd")
				})
			},
			getnum(){
				Numindex({
					member_carpool_id:this.id
				}).then(res=>{
					if(res.data.matching_number_data.length>0){
					this.list=res.data.matching_number_data
					
			
					this.text="已配号等待抽签"
					this.status=2
					console.log("有数据--------")
					}else{
						this.text="等待配号"
						this.status=1
						console.log("没有数据--------")
					}
				})
			},
			//返回
			leftClick() {
				uni.navigateBack();
			},
			//规则说明
			right() {
				this.tipShow=true
			},
			// 选择条件
			select_click(e) {
				this.selectArr.forEach(item => item.isSelect = false)
				e.isSelect = true
				console.log(e)
			},
			// 交付
			submitClick() {

			}
		},
	
				onReachBottom() {
						if (this.status != 'nomore') {
							this.page = this.page + 1
							this.getnum22()
						}
				},
	}
</script>

<style>
	page {
		background-color: #10191F;
	}
</style>

<style lang="scss" scoped>
	@font-face {
		font-family: 'iconfont2';
		src: url("~@/iconfont/YouSheBiaoTiHei.ttf");
	}

	/deep/ .u-navbar__content__title {
		color: #fff !important;
	}

	/deep/.uicon-arrow-left {
		color: #fff !important;
	}

	/deep/ .u-navbar__content__right__text {
		color: #ffffff;
	}
	.prompt {
		position: relative;
		width: 656rpx;
		min-height: 568rpx;
		background: #111B23;
		margin: 0 auto;
		color: #111B23;
		padding-top: 30rpx;
		box-shadow: inset 0rpx 0rpx 20rpx 0rpx #1C85DB;
		
		.prompt_tit {
			margin: 0 auto;
			margin-top: 40rpx;
			width: 540rpx;
			height: 450rpx;
			font-size: 30rpx;
			color: #CFD1D3;
			text-align: left;
			text-overflow: ellipsis;
			display: -webkit-box;
			-webkit-box-orient: vertical;
			// -webkit-line-clamp: 2;
			overflow: hidden;
			// 更多内容显示滚动
			overflow-y: auto;
		}
	}
	.car_v {
		position: relative;
		display: flex;
		flex-direction: column;
		margin-top: 26rpx;
		width: 750rpx;
		height: 600rpx;
		// background-image: url("../../static/image/car_icon_bg.png");
		background-size: 1242rpx 956rpx;
		background-position: 50% 65%;
		.carlogo{
			position: absolute;
			top: 40rpx;
			right: 50rpx;
			width: 80rpx;
			height: 60rpx;
		}
		.bg1 {
			position: absolute;
			top: -50rpx; 
			left: 50%;
			transform: translateX(-50%);
			width: 150%;
			height: 596rpx;
			z-index: 2;
		}
		.bg2 {
			position: absolute;
			top: 120rpx;
			left: 50%;
			transform: translateX(-50%);
			width: 640rpx;
			height: 490rpx;
			z-index: 3;
		}
		.title_v {
			display: flex;
			// justify-content: center;
			align-items: center;
			width: 200rpx;
			height: 28rpx;
			margin-top: 40rpx;

			>image {
				width: 21.6rpx;
				height: 21.6rpx;
				margin-left: 30rpx;
			}

			>text {
				font-size: 28rpx;
				color: #fff;
				margin-left: 2rpx;
			}
		}

		.price_v {
			display: flex;
			// align-items: center;
			width: 90%;
			height: 54rpx;
			margin-top: 6rpx;
			margin-left: 30rpx;
			background-image: url("../../static/image/car1.png");
			background-size: 218rpx 34rpx;
			background-position: left 0% bottom 0%;
			background-repeat: no-repeat;

			>text {
				margin-left: 18rpx;
				line-height: 48rpx;
				font-family: iconfont2;
				font-size: 48rpx;
				color: #26A4F2;
				margin-top: 0rpx;
			}
		}

		.car_img {
			position: absolute;
			bottom: 10rpx;
			left: 50%;
			transform: translate(-50%, 0%);
			width: 576rpx;
			height: 506rpx;
			margin: 0 auto;
		}

		.content {
			width: 336rpx;
			height: 52rpx;
			font-family: iconfont2;
			font-weight: 400;
			font-size: 52rpx;
			line-height: 52rpx;
			text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.6);
			text-align: center;
			font-style: normal;
			text-transform: none;
			color: #80CAF7;
			position: absolute;
			bottom: 0rpx;
			left: 50%;
			transform: translate(-50%);
		}
	}

	.delivery_v {
		display: flex;
		flex-direction: column;
		width: 690rpx;
		// height: 524rpx;
		margin: 0 auto;
		margin-top: 0rpx;
		box-shadow: inset 0rpx 0rpx 30rpx 0rpx #1C85DB;

		>text {
			color: #fff;
			text-align: center;
		}

		.lab_title {
			line-height: 52rpx;
			margin: 0 auto;
			margin-top: 28rpx;
			font-size: 44rpx;
			font-family: iconfont2;
		}

		.lab_title2 {
			line-height: 52rpx;
			margin: 0 auto;
			margin-top: 34rpx;
			margin-left: 62rpx;
			font-size: 32rpx;
		}

		.select_v {
			display: flex;
			align-items: center;
			margin-top: 26rpx;
			width: 100%;
			height: 52rpx;

			.select_img {
				width: 38rpx;
				height: 34rpx;
				margin-left: 74rpx;
			}

			.lab_tit {
				font-size: 30rpx;
				color: #fff;
				margin-left: 12rpx;
			}
		}

		.lab_hint {
			width: 606rpx;
			margin: 0 auto;
			margin-top: 56rpx;
			margin-bottom: 68rpx;
			font-size: 28rpx;
			color: #CFD1D2;
			text-align: left;
		}
	}

	.submit_v {
		display: flex;
		align-items: center;
		width: 690rpx;
		height: 80rpx;
		margin: 0 auto;
		margin-top: 36rpx;
		box-shadow: inset 0rpx 0rpx 30rpx 0rpx #1C85DB;

		>text {
			font-size: 36rpx;
			color: #fff;
			margin: 0 auto;
		}
	}

	// .prompt {
	// 	width: 750rpx;
	// 	min-height: 700rpx;
	// 	background: #111B23;
	// 	margin: 0 auto;
	// 	color: #111B23;
	// 	padding-top: 30rpx;
	// 	box-shadow: inset 0rpx 0rpx 20rpx 0rpx #1C85DB;

	// 	.prompt_tit {
	// 		margin: 0 auto;
	// 		margin-top: 36rpx;
	// 		line-height: 52rpx;
	// 		font-size: 36rpx;
	// 		color: #fff;
	// 	}

	// 	.money_v {
	// 		display: flex;
	// 		position: relative;
	// 		margin: 0 auto;
	// 		margin-top: 40rpx;
	// 		width: 100%;
	// 		height: 52rpx;

	// 		>text {
	// 			font-size: 36rpx;
	// 			color: #fff;
	// 		}

	// 		.lab_hint {
	// 			margin-left: 32rpx;
	// 		}

	// 		.lab_money {
	// 			position: absolute;
	// 			right: 32rpx;
	// 		}
	// 	}
	// }

	.lottery_code {
		width: 690rpx;
		// min-height: 422rpx;
		margin: 0 auto;
		// margin-top: 20rpx;
		margin-top: 20rpx;
		background-size: 100% 100%;
		
	}

	.lottery_code_box {
		display: flex;
		flex-wrap: wrap;
		width: 690rpx;
		max-height: 342rpx;
		// border: 1rpx solid #A68A64;
		border-radius: 10rpx;
		padding-bottom: 40rpx;
		// margin-top: 60rpx;
		overflow-y: auto;
		// padding-bottom: 20rpx;
		box-shadow: inset 0rpx 0rpx 20rpx 0rpx #1C85DB;
	}

	.lottery_box {
		width: 110rpx;
		height: 52rpx;
		box-shadow: inset 0rpx 0rpx 20rpx 0rpx #1C85DB;

		border-radius: 40rpx;
		// margin: 20rpx 12rpx;
		margin-top: 20rpx;
		margin-left: 16rpx;
		margin-right: 12rpx;
		font-size: 32rpx;
		color: #fff;
	}

	.winning {
		position: relative;
		text-align: center;
	}

	.winning>image {
		width: 140rpx;
		height: 68rpx;
		transform: translateX(10rpx);
		z-index: 2;
	}

	.win_txt {
		// position: absolute;
		// top: 16rpx;
		// left: 40rpx;
		font-size: 32rpx;
		color: #FBEFD8;
		z-index: 9;
	}

	.botbox {
		width: 690rpx;
		height: 326rpx;
		box-shadow: inset 0rpx 0rpx 20rpx 0rpx #1C85DB;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0 auto;
		margin-top: 40rpx;
		padding-top: 24rpx;
		position: fixed;
		bottom: 20rpx;
		left: 50%;
		transform: translate(-50%);
		.tit {
			width: 690rpx;
			text-align: center;
			font-weight: 400;
			font-size: 52rpx;
			font-family: iconfont2;
			color: #80CAF7;

		}

		.botbox-wrap {
			width: 690rpx;
			display: flex;
			justify-content: space-around;
			margin-top: 20rpx;
			.botbox-item {
				width: 158rpx;
				height: 182rpx;
				box-shadow: inset 0rpx 0rpx 20rpx 0rpx #1C85DB;
				border-radius: 0rpx 0rpx 0rpx 0rpx;
				font-family: iconfont2;
				font-size: 200rpx;
				text-align: center;
				line-height: 182rpx;
				
				color: #fff;
			}
		}
	}
	.wrap{
		width: 690rpx;
		margin: 0 auto;
		margin-top: 70rpx;
		.tit{
			display: flex;
			font-weight: 400;
			font-size: 32rpx;
			color: #FFFFFF;
			justify-content: space-between;
		}
		.mainwrap{
			width: 690rpx;
			height: 476rpx;
			box-shadow: inset 0rpx 0rpx 20rpx 0rpx #1C85DB;
			border-radius: 0rpx 0rpx 0rpx 0rpx;
			position: relative;
			margin-top: 20rpx;
			padding-bottom: 40rpx;
			.carimg{
				width: 642rpx;
				height: 354rpx;
				border-radius: 0rpx 0rpx 0rpx 0rpx;
				margin-top: 40rpx;
				margin-left: 24rpx;
			}
			.car_logo{
				width: 60rpx;
				height: 80rpx;
				position: absolute;
				top: 24rpx;
				left: 38rpx;
			}
			.tag{
				width: 642rpx;
				margin:  0 auto;
				font-weight: 400;
				font-size: 26rpx;
				color: rgba(255,255,255,0.8);
				display: flex;
				justify-content: space-between;
			}
			.tagimg{
				width: 210rpx;
				height: 184rpx;
				position: absolute;
				right: 64rpx;
				top: 200rpx;
			}
		}
	}
</style>